<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="utf-8"%>
<%@ page import="start.fly.test.database.DBConn"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查询</title>
<script src="../js/jquery-2.1.4.js"></script>
<script src="../js/common.js"></script>
<link href="../css/style4.css" rel="stylesheet" type="text/css" />
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
   <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
</head>
<body>
<div style="width:530px;margin:100px auto;">
<div class="search_box">
<span class="left l_bg"></span>
<span class="right r_bg"></span>
    <div class="search">
    <form name="search_form" action=""  method="post">
        <div id="pt1" class="select">
        <a id="s0">个人会员</a>
        <div style="display:none;" id="pt2" class="part"> 
            <p>
            <a id="s1">个人会员</a>
            <a id="s2">企业会员</a>
            <a id="s3">管理员</a>
            </p>
        </div>
        </div> 
    <input id="catid" name="catid" type="hidden" value="7">
    <input id="q" class="enter" name="username" onFocus="if(this.value=='根据用户名来查询'){this.value='';}else{this.select();}this.style.color='black';"  value="根据用户名来查询">
    <input class="sb" name="Input" type="submit" value="">
    </form>
    </div>
</div>
</div>
<%
    String username=request.getParameter("username");
    if(username!=null){ 
    DBConn conn=new DBConn();
    String  sql="SELECT * FROM user	WHERE username=?";
    try{
    	PreparedStatement stmt=(PreparedStatement)conn.getCon().prepareStatement(sql);
		stmt.setString(1,username);
	   ResultSet  rs=stmt.executeQuery();
	   %>
	   <table class="table table-bordered">
   <thead>
      <tr>
         <th>用户名</th>
         <th>email</th>
         <th>注册日期</th>
         <th>登陆次数</th>
      </tr>
   </thead>
   <% while(rs.next()){%>
   <tbody>
      <tr>
         <td><%=rs.getString("username") %></td>
         <td><%=rs.getString("email") %></td>
         <td><%=rs.getString("registertime") %></td>
          <td><%=rs.getInt("logintime") %></td>
      </tr>
   </tbody>
   <% }%>
</table>
	   <% 
	   conn.close();
    	}catch(SQLException e){
    		e.printStackTrace();
    	}
    
    }
%>
</body>
</html>
